<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>消息详情</title>
    <link rel="stylesheet" href="css/amazeui.min.css" />
    <link rel="stylesheet" href="css/app.css" />
    <link rel="stylesheet" href="css/swiper-3.3.1.min.css" />
    <script src="js/amazeui.min.js" type="text/javascript"></script>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <style>
        body {
            max-width: 640px;
            margin: 0 auto;
            font-size: 10px;
            background: #F2F3F8;
        }

        * {
            box-sizing: border-box;
        }

        [class*=am-u-] {
            padding: 0;
        }
    </style>
</head>

<body>
    <!--头部-->
    <header class="am-u">
        <div class="am-u-sm-12 head_nav" style="margin:0;">
            <div class="am-u-sm-2 am-vertical-align" style="text-align: center;">
                <a href="message.html">
                    <img src="img/return@2x.png" class="am-vertical-align-middle" alt="" />
                </a>
            </div>
            <div class="am-u-sm-8 head_text">
                消息详情
            </div>
            <div class="am-u-sm-2" style="color: #fff;font-size: 13px;text-align: center;">

            </div>
        </div>
    </header>
    <div style="clear: both;"></div>
    <div style="padding: 8px 10px 8px 10px;">
        <div id='msg_bt' style="font-size: 16px;font-weight: bold;">

        </div>
        <div id='add_time' style="font-size: 14px;color: #BABABA;padding-top: 5px;">

        </div>
        <div id='content' style="font-size: 16px;font-weight: bold;padding-top: 5px;">

        </div>
    </div>
    <script src="js/jquery-1.11.3.js"></script>
    <script src="js/loading.js"></script>
    <script>
        var token1 = sessionStorage.getItem("token");
        var you1 = GetQueryString("id");

        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        $.ajax({
            type: 'POST',
            url: "http://www.rice.com/app/api/h5_access",
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            datatype: "JSON",
            data: {
                method: "msg_detail",
                token: token1,
                id: you1
            },
            success: function (data) {
                var data1 = JSON.parse(data);
                console.log(data1);
                if (data1.status === 1) {
                    $("#msg_bt").html(data1.data.data.title);
                    $("#content").html(data1.data.data.content);
                    var hh = data1.data.data.add_time;
                    var date = new Date(hh * 1000);
                    var Y = date.getFullYear() + '-';
                    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) +
                        '-';
                    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
                    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
                    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
                    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
                    if (data1.data.data.message_type == "ad_system") {
                        var ll = "系统消息";
                    } else if (data1.data.data.message_type == "recharge") {
                        var ll = "充值消息";
                    } else if (data1.data.data.message_type == "commission") {
                        var ll = "分润消息";
                    } else if (data1.data.data.message_type == "pay") {
                        var ll = "支付消息";
                    } else if (data1.data.data.message_type == "transfer") {
                        var ll = "转账消息";
                    }
                    $("#add_time").html(Y + M + D + h + m + s + "  " + ll);
                } else if (Number(data1.status) == 2) {
                    alert(data1.message);
                    window.location.href = "login.html";
                } else {
                    alert(data1.message);
                }
            }
        });
    </script>
</body>

</html>